﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes.util {
    import Classes.*;
    import plugin.*;
    import flash.system.*;
    import pixelShader.*;

    public class ConsoleHelper {

        private var console:ConsoleStub;

        public function ConsoleHelper(_arg1:ConsoleStub){
            this.console = _arg1;
            this.init_hotkey();
            this.init_object();
        }
        public static function activate():void{
            var _local1:ConsoleStub = ConsoleStub.getInstance();
            if (_local1 != null){
                _local1.addObject("helper", new ConsoleHelper(_local1), true);
            };
        }

        private function init_hotkey():void{
        }
        private function init_object():void{
        }
        public function get flashMemory():int{
            return (System.totalMemory);
        }
        public function get bitmapMemory():int{
            return ((((((ItemImageAsset.s_pixels - AnimatedAsset.s_pixelSaved) + AnimatedAsset.s_pixelUsed) + AnimatedShaderBitmap.s_pixelUsed) + (3200 * 3200)) * 4));
        }
        public function get savedMemory():int{
            return (((AnimatedAsset.s_pixelSaved + AnimatedShaderBitmap.s_pixelSaved) * 4));
        }
        public function track_asset():String{
            this.console.addHotKey("x", function ():void{
                ItemImageAsset.printStats();
                AnimatedAsset.printStats();
                AnimatedShaderBitmap.printStats();
                console.print("asset", ("Pixels = " + bitmapMemory), 1);
            });
            this.console.addObject("report_bitmap", ItemImageAsset.printStats);
            this.console.addObject("report_sprite", AnimatedAsset.printStats);
            this.console.addObject("report_shader", AnimatedShaderBitmap.printStats);
            this.console.plot("pixels", this, "bitmapMemory");
            this.console.plot("pixels", this, "flashMemory");
            this.console.plot("pixels", this, "savedMemory");
            return ("Assets tracking initialized, hot key = x\n commands = $report_bitmap(), $report_sprite(), $report_sprite()");
        }

    }
}//package Classes.util 
